home *** CD-ROM | disk | FTP | other *** search
- // Copyright (C) 1997-2002 Alias|Wavefront,
- // a division of Silicon Graphics Limited.
- //
- // The information in this file is provided for the exclusive use of the
- // licensees of Alias|Wavefront. Such users have the right to use, modify,
- // and incorporate this code into other products for purposes authorized
- // by the Alias|Wavefront license agreement, without fee.
- //
- // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
- // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
- // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
- // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
- // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
- // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
- // PERFORMANCE OF THIS SOFTWARE.
- //
- //
- // Alias|Wavefront Script File
- // MODIFY THIS AT YOUR OWN RISK
- //
- // Creation Date: Mar. 14, 1997
- // Author: laf
- //
- // Description:
- // The nurbsToPolyPreset() procedure tesselates each
- // selected object.
- //
-
- global proc nurbsToPolyPreset( int $doHistory, int $format,
- int $type, int $count,
- float $chr, float $ft,
- float $mel, float $d,
- int $ut, int $un, int $vt, int $vn,
- int $uch, int $ucr, float $cht, int $es )
- {
- // Get a list of surfaces to tesselate and execute the cmd on each.
- //
- global int $gSelectNurbsSurfacesBit;
-
- string $surfaces[] = `filterExpand -ex true -sm $gSelectNurbsSurfacesBit`;
-
- if( size($surfaces) > 0 ) {
- // Piece together the tesselate command
- //
- string $cmd;
- $cmd = "nurbsToPoly -mnd 1 " + " -ch " + $doHistory + " -f " + $format +
- " -pt " + $type + " -pc " + $count + " -chr " + $chr +
- " -ft " + $ft + " -mel " + $mel + " -d " + $d +
- " -ut " + $ut + " -un " + $un + " -vt " + $vt + " -vn " + $vn +
- " -uch " + $uch + " -ucr " + $ucr + " -cht " + $cht +
- " -es " + $es ;
-
- // Add the flag that will properly map texture space on
- // tesselated trimmed surfaces.
- //
- $cmd = $cmd + " -ntr ";
- $cmd = $cmd + "0";
-
- // add use the existing surface shader flag.
- //
- $cmd = $cmd + " -uss " ;
- $cmd = $cmd + "1" ;
-
- $cmd = $cmd + " %s";
-
- string $results[] = executeForEachObject( $surfaces, $cmd );
- if( (size($results)) == 0 ) {
- error("NURBS to Polygons: Failed on the selected objects.");
- }
- else {
- // Select all the results with one select command. Note that only
- // resulting meshes are selected, not dependency nodes.
- //
- string $selectString;
- $selectString = "select ";
- int $i;
-
- int $numResults = size($results);
- for( $i = 0; $i < $numResults; $i ++ ) {
- $selectString += $results[$i];
- $selectString += " ";
- }
- $selectString += ";";
- select -cl;
- eval($selectString);
- }
- }
- else {
- error( "NURBS to Polygons: No valid items selected." );
- }
- }
-
-